const state = {
  Authorization: '',//当前requestid
};

const getters = {
  getToken(state) {
    let _Authorization = localStorage.getItem("Authorization");
    if ("" != _Authorization && _Authorization != null) {
      state.Authorization = JSON.parse(_Authorization);
    } else {
      state.Authorization = '';
    }
    return state.Authorization;
  },


};

const mutations = {
  //设置当前用户token
  setToken(state, obj) {
    state.Authorization = obj;
    let _Authorization = JSON.stringify(state.Authorization);
    localStorage.setItem("Authorization", _Authorization);
  },
  removeToken() {
    localStorage.removeItem("Authorization");
  }

};


const actions = {
  //设置当前用户token
  setToken(context, obj) {
    context.commit('setToken', obj);
  },
  //清除当前用户token
  removeToken(context) {
    context.commit('removeToken');
  },


};

export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}
